/*
 * @Author: your name
 * @Date: 2021-08-25 11:37:11
 * @LastEditTime: 2021-08-26 14:53:26
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: /backend/src/main/java/com/buaa/demo/Service/ServiceImplements/QuestionServiceImpl.java
 */
package com.buaa.demo.Service.ServiceImplements;

import com.buaa.demo.Dao.QuestionDao;
import com.buaa.demo.Entity.Choice;
import com.buaa.demo.Entity.Question;
import com.buaa.demo.Entity.Questionnaire;
import com.buaa.demo.Entity.ShortAnswer;
import com.buaa.demo.Service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuestionServiceImpl implements QuestionService {

    @Autowired
    public QuestionDao questionDao;

    @Override
    public int addQuestionnaire(Questionnaire qn) {
        return questionDao.addQuestionnaire(qn);
    }

    @Override
    public Questionnaire getQuestionnaireById(int qn_id) {
        return questionDao.getQuestionnaireById(qn_id);
    }

    @Override
    public List<Questionnaire> getQuestionnaireByUId(int user_id) { return questionDao.getQuestionnaireByUId(user_id); }

    @Override
    public void changeState(int qn_id, String state) { questionDao.changeState(qn_id, state); }

    @Override
    public void submitQuestionnaire(int qn_id) { questionDao.submitQuestionnaire(qn_id); }

    @Override
    public void adjustPublishTime(int qn_id, String publish_time){ questionDao.adjustPublishTime(qn_id, publish_time); }

    @Override
    public void addQuestion(Question q) {
        questionDao.addQuestion(q);
    }

    @Override
    public Question getQuestionByQId(int q_id) {
        return questionDao.getQuestionByQId(q_id);
    }

    @Override
    public List<Question> getQuestionByQnId(int qn_id) { return questionDao.getQuestionByQnId(qn_id); }

    @Override
    public void submitQuestion(int q_id) { questionDao.submitQuestion(q_id); }

    @Override
    public void addChoice(Choice c) {
        questionDao.addChoice(c);
    }

    @Override
    public Choice getChoiceByCId(int c_id) {
        return questionDao.getChoiceByCId(c_id);
    }

    @Override
    public List<Choice> getChoiceByQId(int q_id) { return questionDao.getChoiceByQId(q_id); }

    @Override
    public void submitChoice(int c_id) { questionDao.submitChoice(c_id); }

    @Override
    public List<ShortAnswer> getShortAnswerByQId(int q_id) { return questionDao.getShortAnswerByQId(q_id); }

    @Override
    public void submitShortAnswer(ShortAnswer sa) { questionDao.submitShortAnswer(sa); }

    @Override
    public void deleteQuestionnaire(int qn_id) { questionDao.deleteQuestionnaire(qn_id); }

    @Override
    public void deleteQuestion(int q_id) { questionDao.deleteQuestion(q_id); }
}

